using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;


namespace BHXH.LinqRepository
{
    public class ChiTietPhieuRepository : Repository<ChiTietPhieu>
    {
        public ChiTietPhieu GetByPhieuID_MaCau(Guid phieuID, int maCau)
        {
            return dataContext.ChiTietPhieus.Where(c => c.PhieuID == phieuID && c.MaCau == maCau).FirstOrDefault();
        }
        public void InsertOne(ChiTietPhieu one)
        {
            one.ID = Guid.NewGuid();
            Add(one);
            //dataContext.ChiTietPhieus.InsertOnSubmit(one);
        }
        public void EditOne(ChiTietPhieu one)
        {
            //dataContext.ChiTietPhieus.Attach(one, true);
            //Update(one);
        }
        public void DeleteAllByPhieuId(Guid phieuId)
        {
            var obj = dataContext.ChiTietPhieus.Where(c => c.PhieuID == phieuId).ToList();
            dataContext.ChiTietPhieus.DeleteAllOnSubmit(obj);
        }
    }
}
